package entornos.PruebasUnitarias;

public class Cadena {
	private String string;

	public Cadena(String s) {
		string = s;
	}

	public String getCadena() {

		return "''" + string + "''";
	}

	public void cDelante(String tmp) {
		string = (tmp += string);
	}

	public void cDetras(String tmp) {
		string += tmp;
	}

	public void quitar(char c) {
		String sol = "";
		for (int i = 0; i < string.length(); i++) {
			char x = string.charAt(i);
			if (x != c) {
				sol += x;
			}
		}
		string = sol;
	}

	public void quitar(char c, int n) {
		String sol = "";
		int acc = 0;
		for (int i = 0; i < string.length(); i++) {
			char x = string.charAt(i);
			if (x == c && acc < n) {
				acc++;
			} else {
				sol += x;
			}
		}
		string = sol;
	}

}
